using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        // this is just an example, in real you read userid and pass from db....
        if (txtUserID.Text.Equals("admin") && txtPassword.Text.Equals("admin"))
        {
            // login successfully
            Session["login"] = "admin";
            FormsAuthentication.SetAuthCookie(txtUserID.Text, true);
            // Redirect back to request URL.
            if (FormsAuthentication.GetRedirectUrl(txtUserID.Text, true).EndsWith("default.aspx"))
                HttpContext.Current.Response.Redirect("Default.aspx", true);
            else
                Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserID.Text, true));
        }
    }
}
